-- @author lixiyong01
-- @date 20240713

USE hdp_lbg_supin_zplisting;

INSERT INTO TABLE tmp_hism_examples_test001 partition (dt='20240629') VALUES
('1', 'Alice'),
('2', 'Bob'),
('3', 'Charlie');


USE hdp_lbg_supin_zplisting;

INSERT INTO TABLE tmp_hism_examples_test001 partition (dt='20240630') VALUES
('1', '["abc","1213","a123","b234"]'),
('2', '["t001","t1213","ta123","tb234"]'),
('3', '["mabc","m1213","ma123","mb234"]');

INSERT INTO TABLE tmp_hism_examples_test001 partition (dt='20240630') VALUES
('13', '["oaname=lixy01&subject=个人存储\"任务\"账单","","oaname=lixy02&subject=个人存储任务\"账单\""]');

INSERT INTO TABLE tmp_hism_examples_test001 partition (dt='20240630') VALUES
('14', '["oaname=lixy01&subject=个人,存储\"任务\"账单","","oaname=lixy02&subject=个人存储,任务\"账单\""]');

select dist_cnt
from hdp_lbg_supin_zplisting.tmp_hism_examples_test001
where dt='20240630'

select items
from hdp_lbg_supin_zplisting.tmp_hism_examples_test001
lateral view explode(split(dist_cnt, ',')) v as items
where dt='20240630'

select elem
from hdp_lbg_supin_zplisting.tmp_hism_examples_test001
lateral view explode(split(regexp_replace(dist_cnt, '\\[|\\]', ''), '\\"|, ')) v as elem
where dt='20240630';

